package com.woniu.crowd.service.comsumer;

import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayTradeQueryRequest;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.woniu.crowd.infra.config.AlipayConfig;
import com.woniu.crowd.infra.model.CrowdOrder;
import com.woniu.crowd.service.CrowdOrderService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;
import java.util.concurrent.TimeUnit;

@Component
@RocketMQMessageListener(topic = "LXLG-crowd-order-payok", consumerGroup = "LXLG-crowd-order-payok")
public class CrowdOrderPayCallBackConsumer implements RocketMQListener<String> {
    @Resource
    private CrowdOrderService crowdOrderService;


    @Override
    public void onMessage(String message) {
        System.out.println("执行支付成功回调逻辑");
        crowdOrderService.setPayOk(message);
        System.out.println("支付成功回调逻辑执行完毕");
    }
}
